<link href="static/style/imgupload.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="static/js/imgupload.js"></script>
<script type="text/javascript">
    var __IMAGE_IDS__ = {};
    var upload_uid = '0';
    $(function(){
        $(".nav_title{$h_key}").click(function(){
            $(".currtitle{$h_key} .curr").removeClass("curr"); 
            $(this).addClass("curr"); 
            $(".upload_frame{$h_key}").hide(); 
            var id = $(this).attr("currid"); 
            if (id){$("#" + id).show(); 
                if ('upload_frame_2{$h_key}' == id && '' == $("#album_list{$h_key}").html()){
                    get_album('{$h_key}', 0, 1); }
            }
        }); 
        $(".menu_title").click(function(){
            var check_uid = $('#check_PublishBox_uid').val();
            upload_uid = ('undefined' == typeof (check_uid) || check_uid == '') ? '0' : check_uid;
        });
        $('#publisher_file{$h_key}').uploadify({
            'uploader':'{conf site_url}/images/uploadify/uploadify.swf?id=&random=' + Math.random(), 
            'script':'{echo urlencode({conf site_url}."/ajax.php?mod=uploadify&code=image&uninitmember=1&type=flash&iitem={$img_item}&iitemid={$img_itemid}")}', 
            'cancelImg':'{conf site_url}/images/uploadify/cancel.png', 
            'buttonImg':'{conf site_url}/images/uploadify/upload.gif', 
            'width':52, 
            'height':52, 
            'multi':true, 
            'auto':true, 
            'sizeLimit':'{conf image_size_limit}', 
            'fileExt':'*.jpg;*.png;*.gif;*.jpeg', 
            'fileDesc':'请选择图片文件(*.jpg;*.png;*.gif;*.jpeg)', 
            'queueID':'uploadifyQueueDiv', 
            'wmode':'transparent', 
            'fileDataName':'topic', 
            'queueSizeLimit':{conf image_uploadify_queue_size_limit}, 
            'simUploadLimit':1, 
            'scriptData':{'cookie_auth':'{echo urlencode(jsg_getcookie("auth"))}'}, 
            'onSelect':function(event, ID, fileObj){
                var url = '/ajax.php?mod=uploadify&code=image&uid='+upload_uid+'&uninitmember=1&type=flash&iitem={$img_item}&iitemid={$img_itemid}';
                $('#publisher_file{$h_key}').uploadifySettings('script',url);
                $('#publisher_file{$h_key}').uploadifyUpload();
            }, 
            'onSelectOnce':function(event, data){imageUploadifySelectOnce('{$h_key}'); }, 
            'onProgress':function(event, ID, fileObj, data){return false; }, 
            'onComplete':function(event, ID, fileObj, response, data){eval('var r =' + response + ';'); if (r.done){var rv = r.retval; if (rv.id > 0 && rv.src.length > 0) {imageUploadifyComplete('{$h_key}', rv.id, rv.src, fileObj.name); }}}, 
            'onError':function (event, ID, fileObj, errorObj){alert(errorObj.type + 'Error:' + errorObj.info); }, 
            'onAllComplete':function(event, data){imageUploadifyAllComplete('{$h_key}'); }, 
            'onSWFReadyFall':function(){$('#publisher_file{$h_key}').after("<img src='images/uploadify/upload.gif'><div style='position: absolute; left: 10px; top: 87px; display: block; overflow: hidden; background-color: rgb(0, 0, 0); opacity: 0; width: 52px; height: 52px;'><iframe id='imageUploadifyIframe{$h_key}' name='imageUploadifyIframe{$h_key}' width='0' height='0' marginwidth='0' frameborder='0' src='about:blank' style='display:none;'></iframe><fo" + "rm id='normalUploadForm{$h_key}' method='post' action='ajax.php?mod=uploadify&code=image&type=normalnew&iitem={$img_item}&iitemid={$img_itemid}&divid={$h_key}' enctype='multipart/form-data' target='imageUploadifyIframe{$h_key}' style='margin:0;padding:0;'><input type='file' accept='image/*' style='width:52px; height: 52px;cursor:pointer;' id='normalUploadFile{$h_key}' name='topic' onchange=\"document.getElementById('normalUploadForm{$h_key}').submit();imageUploadifySelectOnce('{$h_key}')\"/></form></div>"); }
        }); 
    });
</script>
<div class="imgupload">
    <p class="navtab currtitle{$h_key}">
        <b class="curr nav_title{$h_key}" currid="upload_frame_1{$h_key}">上传图片</b>
        <!--<b class="nav_title{$h_key}" currid="upload_frame_3{$h_key}">网络图片</b>-->
    </p>
    <div class="upload_frame_area">
        <iframe id="frameupimg{$h_key}" name="frameupimg{$h_key}" width="0" height="0" marginwidth="0" frameborder="0" src="about:blank" style="display:none;"></iframe>
        <form id="formalbum{$h_key}">
            <div class="upload_frame{$h_key}" id="upload_frame_1{$h_key}">
                <div id="swfUploadDiv{$h_key}" class="upload_area">
                    <span id="albumlist{$h_key}" style="display:block; margin-bottom:10px;text-align: right;">
                        <label style="float:left;">
                            <input type="checkbox" name="selectallimg" value="1" onchange="selectAllUpImg(this.checked);" onpropertychange="selectAllUpImg(this.checked);">全选
                        </label>
                        <select style="display: none;" name="uploadalbum" id="uploadalbum{$h_key}" onchange="if (this.value == '-1'){selectCreateTab('{$h_key}', 0); }">
                            <option value="0">默认相册</option>
                        </select>
                    </span>
                    <span id="creatalbum{$h_key}"></span>
                    <input type="file" id="publisher_file{$h_key}" name="publisher_file" style="display:none;">
                </div>
                <p class="upload_notice">最多可上传{conf image_uploadify_queue_size_limit}张图片，单张图片大小不超过{eval echo(round($this->Config[image_size]/1024, 2));}M。</p>
                <span id="uploading{$h_key}"></span>
                <table id="viewImgDiv{$h_key}" class="tempimglist">
                    <!--{if $uploadimages}-->
                    <!--{loop $uploadimages $ik $iv}-->
                    <script type="text/javascript"> __IMAGE_IDS__[{$ik}] = $ik;</script>
                    <tr id="upimg_{$ik}"><td valign='top'><input type='checkbox' name='ids[]' value="{$ik}" title='保存到相册'></td><td valign='middle'><a href="javascript:;" id="insert_image_{$ik}" onclick="insertIntoContent('image', {$ik}, 'i_already{$h_key}');" title="点击插入"><img src="{$iv[img]}" width='50' height='50'></a></td><td valign='middle'><textarea name='title[{$ik}]' maxlength='140' onfocus="if (this.value == '图片简介') {this.value = ''; }" onblur="if (this.value == '') {this.value = '图片简介'; }">{$iv[description]}</textarea></td><td valign='middle'><a title="删除图片" onclick="imageUploadifyDelete({$ik}, '{$tid}'); return false;" href="javascript:void(0);" class="u-del">X</a></td></tr>
                    <!--{/loop}-->
                    <!--{/if}-->
                </table>
                <p class="submitbottom"></p>
            </div>
            
            <div class="upload_frame{$h_key}" id="upload_frame_3{$h_key}" style="display:none;">
                <p class="add"><input type="text" id="img_url{$h_key}"  value="请输入图片url地址" onclick="if (this.value == '请输入图片url地址'){this.value = ''; }"/><a href="javascript:void(0);" onclick="getUrlImage('{$h_key}', img_url{$h_key});" class="u-btn" style="color:#fff;">上传图片</a></p>
                <span id="uploading_img{$h_key}" style="display:none"><img src='images/loading.gif'/>&nbsp;上传中，请稍候……</span>
                <table id="viewUrlImgDiv{$h_key}"></table>
                <p class="submitbottom"><input type="button" value="保 存" class="u-btn u-btn-cancel" onclick="saveimgcallback('{$h_key}', '{$handle_key}');"></p>
            </div>
    </div>
</form>
</div>